using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;


namespace BlogEngine.Core
{

	public class PhotoEffectCollection
	{
		static private Dictionary<string, IPhotoEffect> _effects = new Dictionary<string, IPhotoEffect>();

		/// <summary>
		/// Registers the specified photo effect from an object that implements the IPhotoEffect interface
		/// </summary>
		/// <param name="type">The type.</param>
		/// <param name="photoeffect">The photoeffect interface.</param>
		[Obsolete("This methods has been replaced.", false)]
		static public void Register(string name, IPhotoEffect photoeffect)
		{
			_effects.Add(name, photoeffect);
		}


		/// <summary>
		/// Gets the names.
		/// </summary>
		/// <value>The names.</value>
		public static IEnumerable<string> Names
		{
			get
			{
				foreach (string name in _effects.Keys)
					yield return name;
			}
		}

		/// <summary>
		/// Gets the names.
		/// </summary>
		/// <value>The names.</value>
		public static IEnumerable<IPhotoEffect> Methods
		{
			get
			{
				foreach (IPhotoEffect method in _effects.Values)
					yield return method;
			}
		}

		/// <summary>
		/// Gets the photoeffect of the specified type
		/// </summary>
		/// <param name="name">The name.</param>
		/// <returns></returns>
		static public IPhotoEffect GetPhotoEffect(string name)
		{
			IPhotoEffect photoeffect = null;

			if (_effects.TryGetValue(name, out photoeffect))
				return photoeffect;
			else
				return null;
		}

	}
}
